macromedia Your Account International Help
Products Support & Training DevNet Solutions Partners Downloads Store
Products Support & Training DevNet Solutions Partners Downloads Store
Home > Products > Flash > Support > TechNote Index
Macromedia Flash Support Center - TechNote

Leading zero interpreted incorrectly

Issue
Numbers with leading zeros calculate incorrectly.

For example, in the Macromedia Firefly FxGrid component, when a user enters a number with a leading zero(s), an incorrect number is posted to the field. If a user enters 011 in a numeric field, then clicks on a different row to post the change, the value put into the field is 9.

Reason
In ActionScript, numbers with leading zeros are interpreted as octal numbers. The octal number system is a positional notation number system. Just as the decimal system uses powers of 10 and the binary system uses powers of 2, the octal system uses power of 8 to determine the value of a number's position.

For example, the octal integer 011 is interpreted as:
0
1
1
(0*8²) +
(1*8¹) +
(1*8º)


which is equal to:
0
8
1

so the decimal value is:

9

For more information on octal numbers try http://www.tpub.com/neets/book13/53e.htm or enter the keywords octal numbers into any search engine.

Solution
The Flash developer should check for a leading zero in numeric entries and convert or trim as appropriate.



ID: 18632
Product: Flash
Versions: MX
OS: Windows-All
Browser: All
Server: None
Database: None
Former ID:  
How useful was this document?
less more

1

2

3

4

5

How can the document be improved? (300 characters or less - you will not receive a reply.)

Last updated: April 21, 2003
Created: April 29, 2003